
import MySQLdb
class AdvogadoController:

	def __init__(self,nome,rg,cpf):
		self.nome=nome
		self.rg=rg
		self.cpf=cpf

	def insere(self,nome,rg,cpf):
		db=MySQLdb.connect("localhost","root","pt961423","advocatus")
		cursor = db.cursor()
		sql="insert into cliente (nome,rg,cpf) values ('%s','%d','%d')" %(nome,rg,cpf)
			
		try:
		# Execute the SQL command
			cursor.execute(sql)
		# Commit your changes in the database
			db.commit()
		except:
		# Rollback in case there is any error
			db.rollback()
				
			# disconnect from server
			db.close()